<template>
  <!--修复申请-->
  <div class="page">
    <el-form ref="aplayParams" :model="aplayParams" label-width="100px">
      <el-form-item label="修复说明" prop="orapRemark" :rules="[{ message: '请输入修复说明', required: true, trigger:'blur'}]">
        <el-input type="textarea" v-model="aplayParams.orapRemark" :autosize="{ minRows:4, maxRows:6,cols:16}" :maxlength="500"></el-input>
      </el-form-item>
    </el-form>
    <el-button @click="actionCommit">确定</el-button>
    <el-button @click="actionCancel">取消</el-button>
  </div>
</template>
<script>
  import servers from '@/config/servers'
  import net from '@/util/net'
  export default {
    name: 'repair-application',
    data() {
      return {
        aplayParams: {
          cupoId: '',
          orapRemark: '',
          custId: ''
        }
      }
    },
    methods: {
      /**
       * 修复申请确定
       */
      actionCommit() {
        this.$refs['aplayParams'].validate((valid) => {
          if (!valid) {
            return false
          }
          this.aplayParams.cupoId = this.$store.state.accManage.case_id
          net.send({
            server: servers.RepairManage.repair_application,
            data: this.aplayParams
          }).then((data) => {
            this.$message({
              type: 'info',
              message: '申请成功'
            })
            // 重置form
            this.$refs['aplayParams'].resetFields()
            // 刷新外访申请记录
            this.$emit('RecordRefresh')
            // 关闭dialog
            this.$emit('close')
          }, err => {
            this.$message({
              type: 'info',
              message: err.reason
            })
          })
          this.repairApplicationModel = false
        })
      },
      /**
       * 修复申请取消
       */
      actionCancel() {
        // 关闭dialog
        this.$emit('close')
        // 重置form
        this.$refs['aplayParams'].resetFields()
      }
    }
  }

</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less" scoped>


</style>
